public class Vehicle{
    double speed;
    int power;
    void speedUp(int s){
        if(s > 200) {
            System.out.println("超速驾驶，无法加速");
            speed = 200;
            return;
        }

        speed += s;
    }

    void speedDown(int d){
        if(d <= 0) {
            System.out.println("已降至最低速度，无法减速");
            speed = 0;
            return;
        }

        speed -= d;
    }

    //新增：刹车方法
    void brake() {
        speed = 0;
    }

    void setPower(int p){
        power = p;
    }

    int getPower(){
        return power;
    }

    double getSpeed(){
        return speed;
    }
}
